﻿#ifndef GUIDEBUBBLE_H
#define GUIDEBUBBLE_H

#include <QWidget>
#include <QKeyEvent>
#include <QPropertyAnimation>

namespace Ui {
class GuideBubble;
}

class GuideBubble : public QWidget
{
    Q_OBJECT

public:
    explicit GuideBubble(QWidget *parent = nullptr);
    ~GuideBubble();

    void setText(const QString &text);
    void setStepCount(int count);
    void setCurrentStep(int step);

    void setAnimationEnabled(bool enabled);
    void setAnimationDuration(int ms);

    void move(int x, int y);
    void move(const QPoint &p);
    void resize(int w, int h);
    void resize(const QSize &s);
    void setGeometry(int x, int y, int w, int h);
    void setGeometry(const QRect &rect);

protected:
    void animateTo(const QRect &target);
    void keyPressEvent(QKeyEvent *event) override;

signals:
    void prevRequested();
    void nextRequested();
    void doneRequested();

private:
    Ui::GuideBubble *ui;
    int m_stepCnt = 0;
    bool m_animationEnabled = true;
    QPropertyAnimation* m_anim = nullptr;
    int m_duration = 500;
};

#endif // GUIDEBUBBLE_H
